

#include "BaseEntity.h"
#include <cassert> //For the assertion in the code

int BaseEntity::nextValidID = 0;

//Constructor
BaseEntity::BaseEntity(int id)
{
    setID(id);
}

//Sets the ID (Private method)
void BaseEntity::setID(int val)
{
    //Make sure the value is equal to or greater than the next available ID
    assert( (val >= nextValidID) && "<BaseEntity::setID>: invalid ID");
    
    m_ID = val;
    nextValidID = m_ID + 1;
}

//Returns the ID
int BaseEntity::ID() const
{
    return m_ID;
}

